/* ====================================================================
 * The UncleGED Open Source Software License
 *
 * Copyright (c) 1999-2003 D. M. DeBacker. All rights reserved.
 * http://gatheringleaves.org/uged
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. Products derived from this software may not be called "UncleGED",
 *    nor may "UncleGED" appear in their name, without prior written
 *    permission of D. M. DeBacker.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL D. M. DEBACKER BE LIABLE FOR ANY 
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 */

using System;
using System.IO;
using System.Collections;

namespace UGed
{
	//=================================
	public class FamLink 
	{
		private string  mvarFamId;


		public string  FamId  
		{
			get 
			{
				return mvarFamId;
			}
			set 
			{
				mvarFamId = value;
			}
		}
	}


	//============================================
	public class GedcomLine 
	{
		private string  mvarLine = "";
		private int  mvarLineNumber = 0;
		
		public  string  Line 
		{
			get 
			{
				return(mvarLine);
			}
			set 
			{
				mvarLine = value;
			}
		}
		public  int  LineNumber 
		{
			get 
			{
				return(mvarLineNumber);
			}
			set 
			{
				mvarLineNumber = value;
			}
		}
	}


	//============================================
	public class Gendex 
	{
		private string  mvarPageUrl = "";
		private string  mvarSurname = "";
		private string  mvarFullname = "";
		private string  mvarBirthdate = "";
		private string  mvarBirthPlace = "";
		private string  mvarDeathDate = "";
		private string  mvarDeathPlace = "";
		public  string  DeathPlace 
		{
			get 
			{
				return mvarDeathPlace;
			}
			set 
			{
				mvarDeathPlace = value;
			}
		}
		public  string  DeathDate 
		{
			get 
			{
				return  mvarDeathDate;
			}
			set 
			{
				mvarDeathDate = value;
			}
		}
		public  string  BirthPlace 
		{
			get 
			{
				return  mvarBirthPlace;
			}
			set 
			{
				mvarBirthPlace = value;
			}
		}
		public  string  Birthdate 
		{
			get 
			{
				return  mvarBirthdate;
			}
			set 
			{
				mvarBirthdate = value;
			}
		}
		public  string  Fullname 
		{
			get 
			{
				return  mvarFullname;
			}
			set 
			{
				mvarFullname = value;
			}
		}
		public  string  Surname 
		{
			get 
			{
				return  mvarSurname;
			}
			set 
			{
				mvarSurname = value;
			}
		}
		public  string  PageUrl 
		{
			get 
			{
				return  mvarPageUrl;
			}
			set 
			{
				mvarPageUrl = value;
			}
		}
	}
		

	//============================================
	public class IndiLine 
	{
		private int  mvarLineNumber = 0;
		private string  mvarIndividualID = "";
		public  int  LineNumber 
		{
			get 
			{
				return(mvarLineNumber);
			}
			set 
			{
				mvarLineNumber = value;
			}
		}
		public  string  IndividualID 
		{
			get 
			{
				return(mvarIndividualID);
			}
			set 
			{
				mvarIndividualID = value;
			}
		}
	}
		

	//============================================
	public class TimeLine 
	{
		private int  mvarYear = 0;
		private DateTime  mvarActualDate;
		private string  mvarEventDetails = "";
		private bool  mvarIsAbout = false;
		private string  mvarColorCode = "";
		private int  mvarEstimateStyle = 0;

		public TimeLine()
		{
			mvarYear = 0;
			mvarActualDate = new DateTime();
			mvarEventDetails = "";
			mvarIsAbout = false;
			mvarColorCode = "";
			mvarEstimateStyle = 0;
		}

		public  int  EstimateStyle 
		{
			get 
			{
				return mvarEstimateStyle;
			}
			set 
			{
				mvarEstimateStyle = value;
			}
		}
		public  string  ColorCode 
		{
			get 
			{
				return mvarColorCode;
			}
			set 
			{
				mvarColorCode = value;
			}
		}
		public  bool  IsAbout 
		{
			get 
			{
				return mvarIsAbout;
			}
			set 
			{
				mvarIsAbout = value;
			}
		}
		public  string  EventDetails 
		{
			get 
			{
				return mvarEventDetails;
			}
			set 
			{
				mvarEventDetails = value;
			}
		}

		public  DateTime  ActualDate 
		{
			get 
			{
				return mvarActualDate;
			}
			set 
			{
				mvarActualDate = value;
			}
		}
		public  int  TheYear 
		{
			get 
			{
				return(mvarYear);
			}
			set 
			{
				mvarYear = value;
			}
		}
	}
				

	//============================================
	public class FamList: System.Collections.Specialized.NameObjectCollectionBase
	{

		Hashtable ht = new Hashtable();

		public bool Add( string  FamId, string sKey) 
		{
			//create a new object
			FamLink objNewMember;
			objNewMember = new FamLink();

			try 
			{
				//set the properties passed into the method
				objNewMember.FamId = FamId;
				ht.Add(sKey, null); //will fail if duplicate key
				this.BaseAdd(sKey, objNewMember);
				return true;
			} 
			catch 
			{
				return false;
			}
		}


		public void Clear()
		{
			this.BaseClear();
		}

		// the Remove method that takes a string key
		public void Remove(string key)
		{
			this.Remove(key);
		}

		// the Remove method that takes a numeric index
		public void Remove(int index)
		{
			this.Remove(index);
		}

		// the Item property that takes a string key
		public FamLink this[string key]
		{
			get { return (FamLink) this.BaseGet(key); }
			set { this.BaseSet(key, value); }
		}

		// the Item property that takes a numeric index
		public FamLink this[int index]
		{
			get { return (FamLink) this.BaseGet(index); }
			set { this.BaseSet(index, value); }
		}
	}

	
	//============================================
	public class GedcomLines: System.Collections.Specialized.NameObjectCollectionBase
	{
		private int _gclnum;

		Hashtable ht = new Hashtable(); 

		public int Add(string  sLine) 
		{
			GedcomLine  gcl = new GedcomLine();
			
			string  key;

			try 
			{
				_gclnum++;
				key = "GCL" + _gclnum.ToString();
				gcl.LineNumber = _gclnum;
				gcl.Line = sLine;
				ht.Add(key, null); //will fail if duplicate key
				this.BaseAdd(key, gcl);
			} 
			catch 
			{
				_gclnum = 0;
			}

			return _gclnum;

		}

		public void Clear()
		{
			this.BaseClear();
		}

		// the Remove method that takes a string key
		public void Remove(string key)
		{
			this.Remove(key);
		}

		// the Remove method that takes a numeric index
		public void Remove(int index)
		{
			this.Remove(index);
		}

		// the Item property that takes a string key
		public GedcomLine this[string key]
		{
			get { return (GedcomLine) this.BaseGet(key); }
			set { this.BaseSet(key, value); }
		}

		// the Item property that takes a numeric index
		public GedcomLine this[int index]
		{
			get { return (GedcomLine) this.BaseGet(index); }
			set { this.BaseSet(index, value); }
		}
	}

	
	//============================================
	public class Gendices: System.Collections.Specialized.NameObjectCollectionBase
	{

		Hashtable ht = new Hashtable();

		public bool Add( string  PageUrl,  string  Surname,  string  Fullname,  string  Birthdate,  string  BirthPlace,  string  DeathDate,  string  DeathPlace, string  Key ) 
		{
			Gendex NewGendex;

			try 
			{
				NewGendex = new Gendex();
				NewGendex.PageUrl = PageUrl;
				NewGendex.Surname = Surname;
				NewGendex.Fullname = Fullname;
				NewGendex.Birthdate = Birthdate;
				NewGendex.BirthPlace = BirthPlace;
				NewGendex.DeathDate = DeathDate;
				NewGendex.DeathPlace = DeathPlace;
				ht.Add(Key, null); //will fail if duplicate key
				this.BaseAdd(Key, NewGendex);
				return true;
			} 
			catch 
			{
				return false;
			}
		}

		public void Clear()
		{
			this.BaseClear();
		}

		// the Remove method that takes a string key
		public void Remove(string key)
		{
			this.Remove(key);
		}

		// the Remove method that takes a numeric index
		public void Remove(int index)
		{
			this.Remove(index);
		}

		// the Item property that takes a string key
		public Gendex this[string key]
		{
			get { return (Gendex) this.BaseGet(key); }
			set { this.BaseSet(key, value); }
		}

		// the Item property that takes a numeric index
		public Gendex this[int index]
		{
			get { return (Gendex) this.BaseGet(index); }
			set { this.BaseSet(index, value); }
		}
	}


	//============================================
	public class IndiLines: System.Collections.Specialized.NameObjectCollectionBase
	{

		Hashtable ht = new Hashtable();

		public bool Add( string  indiID,  int lineNumber) 
		{

			IndiLine  il = new IndiLine();
			string  key;

			try 
			{
				key = "IL" + lineNumber.ToString();
				il.LineNumber = lineNumber;
				il.IndividualID = indiID;
				ht.Add(key, null); //will fail if duplicate key
				this.BaseAdd(key, il);
				return true;
			} 
			catch
			{
				
				return false;
			}
		}

		public void Clear()
		{
			this.BaseClear();
		}

		// the Remove method that takes a string key
		public void Remove(string key)
		{
			this.Remove(key);
		}

		// the Remove method that takes a numeric index
		public void Remove(int index)
		{
			this.Remove(index);
		}

		// the Item property that takes a string key
		public IndiLine this[string key]
		{
			get { return (IndiLine) this.BaseGet(key); }
			set { this.BaseSet(key, value); }
		}

		// the Item property that takes a numeric index
		public IndiLine this[int index]
		{
			get { return (IndiLine) this.BaseGet(index); }
			set { this.BaseSet(index, value); }
		}
	}


	//============================================
	public class TimeLineEntries: System.Collections.Specialized.NameObjectCollectionBase
	{

		public bool Add( int TheYear,  DateTime ActualDate,  string  EventDetails,  bool IsAbout,  string  ColorCode,  int EstimateStyle, string  Key) 
		{
			//create a new object
			TimeLine objNewMember;
			Hashtable ht = new Hashtable();

			try 
			{
				objNewMember = new TimeLine();

				//set the properties passed into the method
				objNewMember.TheYear = TheYear;
				objNewMember.ActualDate = ActualDate;
				objNewMember.EventDetails = EventDetails;
				objNewMember.IsAbout = IsAbout;
				objNewMember.ColorCode = ColorCode;
				objNewMember.EstimateStyle = EstimateStyle;
				ht.Add(Key, null); //will fail if duplicate key
				this.BaseAdd(Key, objNewMember);
				return true;
			} 
			catch 
			{
				return false;
			}
		}

		public void Clear()
		{
			this.BaseClear();
		}

		// the Remove method that takes a string key
		public void Remove(string key)
		{
			this.Remove(key);
		}

		// the Remove method that takes a numeric index
		public void Remove(int index)
		{
			this.Remove(index);
		}

		// the Item property that takes a string key
		public TimeLine this[string key]
		{
			get { return (TimeLine) this.BaseGet(key); }
			set { this.BaseSet(key, value); }
		}

		// the Item property that takes a numeric index
		public TimeLine this[int index]
		{
			get { return (TimeLine) this.BaseGet(index); }
			set { this.BaseSet(index, value); }
		}
	}



}

